package com.google.android.exoplayer2.source;

import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import androidx.annotation.Nullable;
import java.util.Arrays;

public final class TrackGroupArray implements Parcelable {
    public static final Creator<TrackGroupArray> CREATOR = new Creator<TrackGroupArray>() {
        public /* synthetic */ Object createFromParcel(Parcel parcel) {
            return ॱ(parcel);
        }

        public /* synthetic */ Object[] newArray(int i) {
            return ॱ(i);
        }

        public TrackGroupArray ॱ(Parcel parcel) {
            return new TrackGroupArray(parcel);
        }

        public TrackGroupArray[] ॱ(int i) {
            return new TrackGroupArray[i];
        }
    };
    public static final TrackGroupArray ˎ = new TrackGroupArray(new TrackGroup[0]);
    private int ˊ;
    private final TrackGroup[] ˏ;
    public final int ॱ;

    public TrackGroupArray(TrackGroup... trackGroupArr) {
        this.ˏ = trackGroupArr;
        this.ॱ = trackGroupArr.length;
    }

    TrackGroupArray(Parcel parcel) {
        this.ॱ = parcel.readInt();
        this.ˏ = new TrackGroup[this.ॱ];
        for (int i = 0; i < this.ॱ; i++) {
            this.ˏ[i] = (TrackGroup) parcel.readParcelable(TrackGroup.class.getClassLoader());
        }
    }

    public TrackGroup ˋ(int i) {
        return this.ˏ[i];
    }

    public int ˋ(TrackGroup trackGroup) {
        for (int i = 0; i < this.ॱ; i++) {
            if (this.ˏ[i] == trackGroup) {
                return i;
            }
        }
        return -1;
    }

    public int hashCode() {
        if (this.ˊ == 0) {
            this.ˊ = Arrays.hashCode(this.ˏ);
        }
        return this.ˊ;
    }

    public boolean equals(@Nullable Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        TrackGroupArray trackGroupArray = (TrackGroupArray) obj;
        if (this.ॱ == trackGroupArray.ॱ && Arrays.equals(this.ˏ, trackGroupArray.ˏ)) {
            return true;
        }
        return false;
    }

    public int describeContents() {
        return 0;
    }

    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeInt(this.ॱ);
        for (int i2 = 0; i2 < this.ॱ; i2++) {
            parcel.writeParcelable(this.ˏ[i2], 0);
        }
    }
}
